#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) Huoty, All rights reserved
# Author: Huoty <sudohuoty@163.com>
# CreateTime: 2020-05-08 17:20:28


class NoInstances(type):

    def __call__(self, *args, **kwargs):
        raise TypeError("Can't instantiate directly")


class O(object, metaclass=NoInstances):

    __metaclass__ = NoInstances  # 在 Python 3 中此处无效

    def __init__(self):
        self.a = 1


o = O()
print(o.a)
